package com.zc.zby.basicframedemo.viewholder;

import android.view.View;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.zc.zby.basicframedemo.R;
import com.zc.zby.basicframedemo.adapter.Progress3Adapter;
import com.zc.zby.basicframedemo.model.HuanBaoItemModel;

import java.util.List;

public class Progress3ViewHolder extends BaseViewHolder<HuanBaoItemModel> {

    private TextView mTvTitle, mTvValue;
    private View mTitleLine;

    public Progress3ViewHolder(View itemView) {
        super(itemView);
        mTvTitle = $(R.id.item_huanbao_title);
        mTvValue = $(R.id.item_huanbao_value);
        mTitleLine = $(R.id.item_huanbao_title_line);
    }

    @Override
    public void setData(HuanBaoItemModel data) {
        super.setData(data);
        mTvTitle.setText(data.title);
        mTvValue.setText(data.value);
        Progress3Adapter ownerAdapter = getOwnerAdapter();
        List<HuanBaoItemModel> allData = ownerAdapter.getAllData();
        mTitleLine.setVisibility(getAdapterPosition() == (allData.size() - 1) ? View.GONE : View.VISIBLE);
    }
}
